package com.edu.exam.enums.examination;

/**
 * 检测状态枚举
 *
 * @author System
 * @version 1.0.0
 * @since 2025-11-12
 */
public enum DetectionStatus {
    PENDING("pending", "待处理"),
    DETECTED("detected", "已检测"),
    IN_PROGRESS("in_progress", "处理中"),
    RESOLVED("resolved", "已解决"),
    IGNORED("ignored", "已忽略"),
    ESCALATED("escalated", "已升级");

    private final String code;
    private final String description;

    DetectionStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static DetectionStatus fromCode(String code) {
        for (DetectionStatus status : DetectionStatus.values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown detection status code: " + code);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}